home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / 335_04.zip / FRYYLEX.C < prev    next >
C/C++ Source or Header  |  1993-04-13  |  30KB  |  1,089 lines

  1. /*
  2. HEADER:     ;
  3. TITLE:         Frankenstein Cross Assemblers;
  4. VERSION:     2.0;
  5. DESCRIPTION: "    Reconfigurable Cross-assembler producing Intel (TM)
  6.         Hex format object records.  ";
  7. KEYWORDS:     cross-assemblers, 1805, 2650, 6301, 6502, 6805, 6809, 
  8.         6811, tms7000, 8048, 8051, 8096, z8, z80;
  9. SYSTEM:     UNIX, MS-Dos ;
  10. FILENAME:     fryylex.c;
  11. WARNINGS:     "This software is in the public domain.  
  12.         Any prior copyright claims are relinquished.  
  13.  
  14.         This software is distributed with no warranty whatever.  
  15.         The author takes no responsibility for the consequences 
  16.         of its use.
  17.  
  18.         Yacc (or Bison) required to compile."  ;
  19. SEE-ALSO:     as*.y (yacc input files);
  20. AUTHORS:     Mark Zenier;
  21. COMPILERS:     Microport Sys V/AT, ATT Yacc, Turbo C V1.5, Bison (CUG disk 285)
  22.         (previous versions Xenix, Unisoft 68000 Version 7, Sun 3);
  23. */
  24.  
  25.  
  26. /*
  27.     description    lexical analyzer for framework cross assembler
  28.     usage        Framework cross assembler, Unix
  29.     history        September 13, 1987
  30.             September 14, 1990  Dosify, 6 char unique names
  31.             October, 1990  hand carved scanner
  32. */
  33.  
  34. #include <stdio.h>
  35. #include "frasmdat.h"
  36. #include "fraytok.h"
  37.  
  38. #ifndef DEBUG
  39. #define DEBUG 0
  40. #endif
  41.  
  42.     extern YYSTYPE yylval; 
  43.  
  44.     enum symflag {Symopcode, Symsym} whichsym = Symopcode;
  45.  
  46.     FILE *yyin;
  47.  
  48.     char finbuff[INBUFFSZ] = "L:"; 
  49.         /* initialization nonreusable, wiped out by pass 2 */
  50.     static char *frainptr = &finbuff[2];
  51.         /* point to null byte after L: on start up */
  52.     enum readacts nextreadact = Nra_normal;
  53.  
  54.  
  55. frareadrec()
  56. /*
  57.     description    read a line, on end of file, pop the include file
  58.             stack.
  59.     return        FALSE    got a line
  60.             TRUE    end of input
  61. */
  62. {
  63.     while( fgets(&finbuff[2], INBUFFSZ -2, yyin) == (char *)NULL)
  64.     {
  65.         if(currfstk == 0)
  66.         {
  67.             return TRUE;
  68.         }
  69.         else
  70.         {
  71.             fclose(yyin);
  72.             yyin = infilestk[--currfstk].fpt;
  73.             fprintf(intermedf, "X:%s\n",infilestk[currfstk].fnm);
  74.         }
  75.     }
  76.     return FALSE;
  77. }
  78.  
  79. static int currtok=0; /* subscript of next token to return */
  80. static int intokcnt=0; /* number of tokens in queue */
  81.  
  82. static struct
  83. {
  84.     char *textstrt, *textend;
  85.     YYSTYPE  lvalv;
  86.     int tokv; 
  87.     enum {Yetprint, Yetsymbol, Yetreserved, Yetopcode, 
  88.         Yetconstant, Yetstring, Yetunprint, Yetinvalid } errtype;
  89. }  scanqueue[INBUFFSZ], *lasttokfetch, *nexttokload;
  90.  
  91. static char tempstrpool[2*INBUFFSZ];
  92. static char *tptrstr;
  93.  
  94. #define     CXC00_SKIP    0
  95. #define     CXC01_SPACE    1
  96. #define     CXC02_NL    2
  97. #define     CXC03_LETTER    3
  98. #define     CXC04_QUOTE    4
  99. #define     CXC05_OTHER    5
  100. #define     CXC06_DOLLAR    6
  101. #define     CXC07_PERCENT    7
  102. #define     CXC08_APP    8
  103. #define     CXC09_BIN    9
  104. #define     CXC10_OCT    10
  105. #define     CXC11_DEC    11
  106. #define     CXC12_SEMIC    12
  107. #define     CXC13_LT    13
  108. #define     CXC14_EQ    14
  109. #define     CXC15_GT    15
  110. #define     CXC16_AT    16
  111. #define     CXC17_HEXU    17
  112. #define     CXC18_B    18
  113. #define     CXC19_D    19
  114. #define     CXC20_H    20
  115. #define     CXC21_OQ    21
  116. #define     CXC22_HEXL    22
  117. #define     CXC23_BL    23
  118. #define     CXC24_DL    24
  119. #define     CXC25_BSLASH    25
  120. #define  NUMCHARSETS    26
  121.  
  122. static char chartrantab[128] = {
  123. /* 00 nul soh stx etx*/  CXC00_SKIP, CXC00_SKIP, CXC00_SKIP, CXC00_SKIP,
  124. /* 04 eot enq ack bel*/  CXC00_SKIP, CXC00_SKIP, CXC00_SKIP, CXC00_SKIP,
  125. /* 08 bs  ht  nl  vt */  CXC00_SKIP, CXC01_SPACE, CXC02_NL, CXC00_SKIP,
  126. /* 0c np  cr  so  si */  CXC00_SKIP, CXC00_SKIP, CXC00_SKIP, CXC00_SKIP,
  127. /* 10 dle dc1 dc2 dc3*/  CXC00_SKIP, CXC00_SKIP, CXC00_SKIP, CXC00_SKIP,
  128. /* 14 dc4 nak syn etb*/  CXC00_SKIP, CXC00_SKIP, CXC00_SKIP, CXC00_SKIP,
  129. /* 18 can em  sub esc*/  CXC00_SKIP, CXC00_SKIP, CXC00_SKIP, CXC00_SKIP,
  130. /* 1c fs  gs  rs  us */  CXC00_SKIP, CXC00_SKIP, CXC00_SKIP, CXC00_SKIP,
  131. /* 20 sp  !  "  # */  CXC01_SPACE, CXC03_LETTER, CXC04_QUOTE, CXC05_OTHER,
  132. /* 24  $  %  &  ' */  CXC06_DOLLAR, CXC07_PERCENT, CXC03_LETTER, CXC08_APP,
  133. /* 28  (  )  *  + */  CXC05_OTHER, CXC05_OTHER, CXC05_OTHER, CXC05_OTHER,
  134. /* 2c  ,  -  .  / */  CXC05_OTHER, CXC05_OTHER, CXC05_OTHER, CXC05_OTHER,
  135. /* 30  0  1  2  3 */  CXC09_BIN, CXC09_BIN, CXC10_OCT, CXC10_OCT,
  136. /* 34  4  5  6  7 */  CXC10_OCT, CXC10_OCT, CXC10_OCT, CXC10_OCT,
  137. /* 38  8  9  :  ; */  CXC11_DEC, CXC11_DEC, CXC05_OTHER, CXC12_SEMIC,
  138. /* 3c  <  =  >  ? */  CXC13_LT, CXC14_EQ, CXC15_GT, CXC05_OTHER,
  139. /* 40  @  A  B  C */  CXC16_AT, CXC17_HEXU, CXC18_B, CXC17_HEXU,
  140. /* 44  D  E  F  G */  CXC19_D, CXC17_HEXU, CXC17_HEXU, CXC03_LETTER,
  141. /* 48  H  I  J  K */  CXC20_H, CXC03_LETTER, CXC03_LETTER, CXC03_LETTER,
  142. /* 4c  L  M  N  O */  CXC03_LETTER, CXC03_LETTER, CXC03_LETTER, CXC21_OQ,
  143. /* 50  P  Q  R  S */  CXC03_LETTER, CXC21_OQ, CXC03_LETTER, CXC03_LETTER,
  144. /* 54  T  U  V  W */  CXC03_LETTER, CXC03_LETTER, CXC03_LETTER, CXC03_LETTER,
  145. /* 58  X  Y  Z  [ */  CXC03_LETTER, CXC03_LETTER, CXC03_LETTER, CXC05_OTHER,
  146. /* 5c  \  ]  ^  _ */  CXC25_BSLASH, CXC05_OTHER, CXC03_LETTER, CXC03_LETTER,
  147. /* 60  `  a  b  c */  CXC05_OTHER, CXC22_HEXL, CXC23_BL, CXC22_HEXL,
  148. /* 64  d  e  f  g */  CXC24_DL, CXC22_HEXL, CXC22_HEXL, CXC03_LETTER,
  149. /* 68  h  i  j  k */  CXC20_H, CXC03_LETTER, CXC03_LETTER, CXC03_LETTER,
  150. /* 6c  l  m  n  o */  CXC03_LETTER, CXC03_LETTER, CXC03_LETTER, CXC21_OQ,
  151. /* 70  p  q  r  s */  CXC03_LETTER, CXC21_OQ, CXC03_LETTER, CXC03_LETTER,
  152. /* 74  t  u  v  w */  CXC03_LETTER, CXC03_LETTER, CXC03_LETTER, CXC03_LETTER,
  153. /* 78  x  y  z  { */  CXC03_LETTER, CXC03_LETTER, CXC03_LETTER, CXC05_OTHER,
  154. /* 7c vb  }  ~  del*/  CXC05_OTHER, CXC05_OTHER, CXC03_LETTER, CXC00_SKIP } ;
  155.  
  156.  
  157. #if DEBUG
  158.  
  159. static char * statelab[] = {
  160.         " 0 start of label",
  161.         " 1 comment",
  162.         " 2 label",
  163.         " 3 rest of line",
  164.         " 4 symbol",
  165.         " 5 dollar",
  166.         " 6 hex dollar",
  167.         " 7 at sign",
  168.         " 8 octal at",
  169.         " 9 percent",
  170.         "10 bin percent",
  171.         "11 quote string",
  172.         "12 appos. string",
  173.         "13 greater than",
  174.         "14 less than",
  175.         "15 base 2 maybe",
  176.         "16 base 8 maybe",
  177.         "17 base 10 maybe",
  178.         "18 hex",
  179.         "19 found b ",
  180.         "20 found d",
  181.         "21 bslash quote",
  182.         "22 bslash appos",
  183.         };
  184.             
  185. static char *actlab[] = {
  186.         " 0 skip/no op",
  187.         " 1 load EOL token",
  188.         " 2 start string",
  189.         " 3 process label",
  190.         " 4 save string char",
  191.         " 5 load single char token",
  192.         " 6 load EQ token",
  193.         " 7 process symbol",
  194.         " 8 load $ token",
  195.         " 9 setup for $hex",
  196.         "10 accumulate 0-9 constant",
  197.         "11 accumulate A-F constant",
  198.         "12 accumulate a-f constant",
  199.         "13 load Constant token",
  200.         "14 load @ token",
  201.         "15 setup for @octal",
  202.         "16 setup for %binary",
  203.         "17 load % token",
  204.         "18 load String token",
  205.         "19 load GE token",
  206.         "20 load GT token",
  207.         "21 load LE token",
  208.         "22 load NE token",
  209.         "23 load LT token",
  210.         "24 save numeric char 0-9",
  211.         "25 save numeric char A-F",
  212.         "26 save numeric char a-f",
  213.         "27 convert numeric string base 2",
  214.         "28 convert numeric string base 8",
  215.         "29 convert numeric string base 10",
  216.         "30 convert numeric string base 16",
  217.         "31 save numeric 0xb",
  218.         "32 save numeric 0xd",
  219.         "33 set text start",
  220.         "34 token choke"
  221.         };
  222.  
  223. #endif  /* DEBUG */
  224.  
  225. static struct
  226. {
  227.     char action;
  228.     char nextstate;
  229.     char contin;
  230. }     *thisact, characttab [23][NUMCHARSETS] =
  231. {
  232. /*
  233.     STATE 0 =    {start of label}
  234. */
  235.     {
  236.     /* SKIP    */      /* SPACE   */    /* NL      */      /* LETTER  */ 
  237.     /* QUOTE   */      /* OTHER   */    /* DOLLAR  */      /* PERCENT */ 
  238.     /* APP     */      /* BIN     */     /* OCT     */      /* DEC     */ 
  239.     /* SEMIC   */      /* LT      */    /* EQ      */      /* GT      */ 
  240.     /* AT      */      /* HEXU    */    /* B       */      /* D       */ 
  241.     /* H       */      /* OQ      */    /* HEXL    */      /* BL      */ 
  242.     /* DL      */     /* BSLASH  */
  243.     {0, 0, FALSE},    {0, 3, FALSE},    {1, 0, FALSE},    {2, 2, TRUE},
  244.     {2,11, FALSE},    {5, 3, FALSE},    {33, 5, FALSE},    {33, 9, FALSE},
  245.     {2,12, FALSE},    {2,15, TRUE},    {2,16, TRUE},    {2,17, TRUE},
  246.     {0, 1, FALSE},    {0,14, FALSE},    {6, 3, FALSE},    {0,13, FALSE},
  247.     {33, 7, FALSE},    {2, 2, TRUE},    {2, 2, TRUE},    {2, 2, TRUE},
  248.     {2, 2, TRUE},    {2, 2, TRUE},    {2, 2, TRUE},    {2, 2, TRUE},
  249.     {2, 2, TRUE},    {5, 3, FALSE}
  250.     },
  251.  
  252. /*
  253.     STATE 1 =    {comment}
  254. */
  255.     {
  256.     {0, 1, FALSE},    {0, 1, FALSE},    {1, 0, FALSE},    {0, 1, FALSE},
  257.     {0, 1, FALSE},    {0, 1, FALSE},    {0, 1, FALSE},    {0, 1, FALSE},
  258.     {0, 1, FALSE},    {0, 1, FALSE},    {0, 1, FALSE},    {0, 1, FALSE},
  259.     {0, 1, FALSE},    {0, 1, FALSE},    {0, 1, FALSE},    {0, 1, FALSE},
  260.     {0, 1, FALSE},    {0, 1, FALSE},    {0, 1, FALSE},    {0, 1, FALSE},
  261.     {0, 1, FALSE},    {0, 1, FALSE},    {0, 1, FALSE},    {0, 1, FALSE},
  262.     {0, 1, FALSE},    {0, 1, FALSE} 
  263.     },
  264.  
  265. /*
  266.     STATE 2 =    {label}
  267. */
  268.     {
  269.     {0, 2, FALSE},    {3, 3, FALSE},    {3, 3, TRUE},    {4, 2, FALSE},
  270.     {3, 3, TRUE},    {3, 3, TRUE},    {3, 3, TRUE},    {3, 3, TRUE},
  271.     {3, 3, TRUE},    {4, 2, FALSE},    {4, 2, FALSE},    {4, 2, FALSE},
  272.     {3, 1, FALSE},    {3,14, FALSE},    {3, 3, TRUE},    {3,13, FALSE},
  273.     {3, 3, TRUE},    {4, 2, FALSE},    {4, 2, FALSE},    {4, 2, FALSE},
  274.     {4, 2, FALSE},    {4, 2, FALSE},    {4, 2, FALSE},    {4, 2, FALSE},
  275.     {4, 2, FALSE},  {3, 3, TRUE} 
  276.     },
  277.  
  278. /*
  279.     STATE 3  =    {rest of line}
  280. */
  281.     {
  282.     {0, 3, FALSE},    {0, 3, FALSE},    {1, 0, FALSE},    {2, 4, TRUE},
  283.     {2,11, FALSE},    {5, 3, FALSE},    {33, 5, FALSE},    {33, 9, FALSE},
  284.     {2,12, FALSE},    {2,15, TRUE},    {2,16, TRUE},    {2,17, TRUE},
  285.     {0, 1, FALSE},    {0,14, FALSE},    {6, 3, FALSE},    {0,13, FALSE},
  286.     {33, 7, FALSE},    {2, 4, TRUE},    {2, 4, TRUE},    {2, 4, TRUE},
  287.     {2, 4, TRUE},    {2, 4, TRUE},    {2, 4, TRUE},    {2, 4, TRUE},
  288.     {2, 4, TRUE} ,    {5, 3, FALSE}
  289.     },
  290.  
  291. /*
  292.     STATE 4 =    {symbol}
  293. */
  294.     {
  295.     {0, 4, FALSE},    {7, 3, FALSE},    {7, 3, TRUE},    {4, 4, FALSE},
  296.     {7, 3, TRUE},    {7, 3, TRUE},    {7, 3, TRUE},    {7, 3, TRUE},
  297.     {7, 3, TRUE},    {4, 4, FALSE},    {4, 4, FALSE},    {4, 4, FALSE},
  298.     {7, 1, FALSE},    {7,14, FALSE},    {7, 3, TRUE},    {7,13, FALSE},
  299.     {7, 3, TRUE},    {4, 4, FALSE},    {4, 4, FALSE},    {4, 4, FALSE},
  300.     {4, 4, FALSE},    {4, 4, FALSE},    {4, 4, FALSE},    {4, 4, FALSE},
  301.     {4, 4, FALSE},    {7, 3, TRUE}
  302.     },
  303.  
  304. /*
  305.     STATE 5 =    {dollar}
  306. */
  307.     {
  308.     {0, 5, FALSE},    {8, 3, FALSE},    {8, 3, TRUE},    {8, 3, TRUE},
  309.     {8, 3, TRUE},    {8, 3, TRUE},    {8, 3, TRUE},    {8, 3, TRUE},
  310.     {8, 3, TRUE},    {9, 6, TRUE},    {9, 6, TRUE},    {9, 6, TRUE},
  311.     {8, 1, FALSE},    {8,14, FALSE},    {8, 3, TRUE},    {8,13, FALSE},
  312.     {8, 3, TRUE},    {9, 6, TRUE},    {9, 6, TRUE},    {9, 6, TRUE},
  313.     {8, 3, TRUE},    {8, 3, TRUE},    {9, 6, TRUE},    {9, 6, TRUE},
  314.     {9, 6, TRUE} ,    {8, 3, TRUE}
  315.     },
  316.  
  317. /*
  318.     STATE 6 =    {dollar hex}
  319. */
  320.  
  321.     {
  322.     {0, 6, FALSE},    {13, 3, FALSE},    {13, 3, TRUE},    {13, 3, TRUE},
  323.     {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},
  324.     {13, 3, TRUE},    {10, 6, FALSE},    {10, 6, FALSE},    {10, 6, FALSE},
  325.     {13, 1, FALSE},    {13,14, FALSE},    {13, 3, TRUE},    {13,13, FALSE},
  326.     {13, 3, TRUE},    {11, 6, FALSE},    {11, 6, FALSE},    {11, 6, FALSE},
  327.     {13, 3, TRUE},    {13, 3, TRUE},    {12, 6, FALSE},    {12, 6, FALSE},
  328.     {12, 6, FALSE},    {13, 3, TRUE}
  329.     },
  330. /*
  331.     STATE 7 =    {at sign}
  332. */
  333.     {
  334.     {0, 7, FALSE},    {14, 3, FALSE},    {14, 3, TRUE},    {14, 3, TRUE},
  335.     {14, 3, TRUE},    {14, 3, TRUE},    {14, 3, TRUE},    {14, 3, TRUE},
  336.     {14, 3, TRUE},    {15, 8, TRUE},    {15, 8, TRUE},    {14, 3, TRUE},
  337.     {14, 1, FALSE},    {14,14, FALSE},    {14, 3, TRUE},    {14,13, FALSE},
  338.     {14, 3, TRUE},    {14, 3, TRUE},    {14, 3, TRUE},    {14, 3, TRUE},
  339.     {14, 3, TRUE},    {14, 3, TRUE},    {14, 3, TRUE},    {14, 3, TRUE},
  340.     {14, 3, TRUE},    {14, 3, TRUE}
  341.     },
  342.  
  343. /*
  344.     STATE 8 =    {at octal}
  345. */
  346.     {
  347.     {0, 8, FALSE},    {13, 3, FALSE},    {13, 3, TRUE},    {13, 3, TRUE},
  348.     {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},
  349.     {13, 3, TRUE},    {10, 8, FALSE},    {10, 8, FALSE},    {13, 3, TRUE},
  350.     {13, 1, FALSE},    {13,14, FALSE},    {13, 3, TRUE},    {13,13, FALSE},
  351.     {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},
  352.     {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},
  353.     {13, 3, TRUE},    {13, 3, TRUE}
  354.     },
  355.  
  356. /*
  357.     STATE 9 =    {percent}
  358. */
  359.     {
  360.     {0, 9, FALSE},    {17, 3, FALSE},    {17, 3, TRUE},    {17, 3, TRUE},
  361.     {17, 3, TRUE},    {17, 3, TRUE},    {17, 3, TRUE},    {17, 3, TRUE},
  362.     {17, 3, TRUE},    {16,10, TRUE},    {17, 3, TRUE},    {17, 3, TRUE},
  363.     {17, 1, FALSE},    {17,14, FALSE},    {17, 3, TRUE},    {17,13, FALSE},
  364.     {17, 3, TRUE},    {17, 3, TRUE},    {17, 3, TRUE},    {17, 3, TRUE},
  365.     {17, 3, TRUE},    {17, 3, TRUE},    {17, 3, TRUE},    {17, 3, TRUE},
  366.     {17, 3, TRUE},    {17, 3, TRUE}
  367.     },
  368.  
  369. /*
  370.     STATE 10 =    {percent binary}
  371. */
  372.     {
  373.     {0,10, FALSE},    {13, 3, FALSE},    {13, 3, TRUE},    {13, 3, TRUE},
  374.     {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},
  375.     {13, 3, TRUE},    {10,10, FALSE},    {13, 3, TRUE},    {13, 3, TRUE},
  376.     {13, 1, FALSE},    {13,14, FALSE},    {13, 3, TRUE},    {13,13, FALSE},
  377.     {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},
  378.     {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},    {13, 3, TRUE},
  379.     {13, 3, TRUE},    {13, 3, TRUE}
  380.     },
  381.  
  382. /*
  383.     STATE 11 =    {quote string}
  384. */
  385.     {
  386.     {0,11, FALSE},    {4,11, FALSE},    {34, 3, TRUE},    {4,11, FALSE},
  387.     {18, 3, FALSE},    {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},
  388.     {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},
  389.     {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},
  390.     {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},
  391.     {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},
  392.     {4,11, FALSE},  {4,21, FALSE}
  393.     },
  394.  
  395. /*
  396.     STATE 12 =    {app string}
  397. */
  398.     {
  399.     {0,12, FALSE},    {4,12, FALSE},    {34, 3, TRUE},    {4,12, FALSE},
  400.     {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},
  401.     {18, 3, FALSE},    {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},
  402.     {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},
  403.     {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},
  404.     {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},
  405.     {4,12, FALSE},    {4,22, FALSE}
  406.     },
  407.  
  408. /*
  409.     STATE 13 =    {greater than}
  410. */
  411.     {
  412.     {0,13, FALSE},    {20, 3, FALSE},    {20, 3, TRUE},    {20, 3, TRUE},
  413.     {20, 3, TRUE},    {20, 3, TRUE},    {20, 3, TRUE},    {20, 3, TRUE},
  414.     {20, 3, TRUE},    {20, 3, TRUE},    {20, 3, TRUE},    {20, 3, TRUE},
  415.     {20, 1, FALSE},    {20,14, FALSE},    {19, 3, FALSE},    {20,13, FALSE},
  416.     {20, 3, TRUE},    {20, 3, TRUE},    {20, 3, TRUE},    {20, 3, TRUE},
  417.     {20, 3, TRUE},    {20, 3, TRUE},    {20, 3, TRUE},    {20, 3, TRUE},
  418.     {20, 3, TRUE},    {20, 3, TRUE}
  419.     },
  420.  
  421. /*
  422.     STATE 14 =    {less than}
  423. */
  424.     {
  425.     {0,14, FALSE},    {23, 3, FALSE},    {23, 3, TRUE},    {23, 3, TRUE},
  426.     {23, 3, TRUE},    {23, 3, TRUE},    {23, 3, TRUE},    {23, 3, TRUE},
  427.     {23, 3, TRUE},    {23, 3, TRUE},    {23, 3, TRUE},    {23, 3, TRUE},
  428.     {23, 1, FALSE},    {23,14, FALSE},    {21, 3, FALSE},    {22,13, FALSE},
  429.     {23, 3, TRUE},    {23, 3, TRUE},    {23, 3, TRUE},    {23, 3, TRUE},
  430.     {23, 3, TRUE},    {23, 3, TRUE},    {23, 3, TRUE},    {23, 3, TRUE},
  431.     {23, 3, TRUE},    {23, 3, TRUE}
  432.     },
  433.  
  434. /*
  435.     STATE 15 =    {base 2 maybe}
  436. */
  437.     {
  438.     {0,15, FALSE},    {29, 3, FALSE},    {29, 3, TRUE},    {29, 3, TRUE},
  439.     {29, 3, TRUE},    {29, 3, TRUE},    {29, 3, TRUE},    {29, 3, TRUE},
  440.     {29, 3, TRUE},    {24,15, FALSE},    {24,16, FALSE},    {24,17, FALSE},
  441.     {29, 1, FALSE},    {29,14, FALSE},    {29, 3, TRUE},    {29,13, FALSE},
  442.     {29, 3, TRUE},    {25,18, FALSE},    {0,19, FALSE},    {0,20, FALSE},
  443.     {30, 3, FALSE},    {28, 3, FALSE},    {26,18, FALSE},    {0,19, FALSE},
  444.     {0,20, FALSE},    {29, 3, TRUE}
  445.     },
  446.  
  447. /*
  448.     STATE 16 =    {base 8 maybe}
  449. */
  450.     {    
  451.     {0,16, FALSE},    {29, 3, FALSE},    {29, 3, TRUE},    {29, 3, TRUE},
  452.     {29, 3, TRUE},    {29, 3, TRUE},    {29, 3, TRUE},    {29, 3, TRUE},
  453.     {29, 3, TRUE},    {24,16, FALSE},    {24,16, FALSE},    {24,17, FALSE},
  454.     {29, 1, FALSE},    {29,14, FALSE},    {29, 3, TRUE},    {29,13, FALSE},
  455.     {29, 3, TRUE},    {25,18, FALSE},    {25,18, FALSE},    {0,20, FALSE},
  456.     {30, 3, FALSE},    {28, 3, FALSE},    {26,18, FALSE},    {26,18, FALSE},
  457.     {0,20, FALSE},    {29, 3, TRUE}
  458.     },
  459.  
  460. /*
  461.     STATE 17 =    {base10 maybe}
  462. */
  463.     {    
  464.     {0,17, FALSE},    {29, 3, FALSE},    {29, 3, TRUE},    {29, 3, TRUE},
  465.     {29, 3, TRUE},    {29, 3, TRUE},    {29, 3, TRUE},    {29, 3, TRUE},
  466.     {29, 3, TRUE},    {24,17, FALSE},    {24,17, FALSE},    {24,17, FALSE},
  467.     {29, 1, FALSE},    {29,14, FALSE},    {29, 3, TRUE},    {29,13, FALSE},
  468.     {29, 3, TRUE},    {25,18, FALSE},    {25,18, FALSE},    {0,20, FALSE},
  469.     {30, 3, FALSE},    {34, 3, FALSE},    {26,18, FALSE},    {26,18, FALSE},
  470.     {0,20, FALSE},    {29, 3, TRUE}
  471.     },
  472.  
  473. /*
  474.     STATE 18 =    {hex}
  475. */
  476.     {    
  477.     {0,18, FALSE},    {34, 3, FALSE},    {34, 3, TRUE},    {34, 3, TRUE},
  478.     {34, 3, TRUE},    {34, 3, TRUE},    {34, 3, TRUE},    {34, 3, TRUE},
  479.     {34, 3, TRUE},    {24,18, FALSE},    {24,18, FALSE},    {24,18, FALSE},
  480.     {34, 1, FALSE},    {34,14, FALSE},    {34, 3, TRUE},    {34,13, FALSE},
  481.     {34, 3, TRUE},    {25,18, FALSE},    {25,18, FALSE},    {25,18, FALSE},
  482.     {30, 3, FALSE},    {34, 3, TRUE},    {26,18, FALSE},    {26,18, FALSE},
  483.     {26,18, FALSE},    {34, 3, TRUE}
  484.     },
  485.  
  486. /*
  487.     STATE 19 =    {bin or hex}
  488. */
  489.     {    
  490.     {0,19, FALSE},    {27, 3, FALSE},    {27, 3, TRUE},    {27, 3, TRUE},
  491.     {27, 3, TRUE},    {27, 3, TRUE},    {27, 3, TRUE},    {27, 3, TRUE},
  492.     {27, 3, TRUE},    {31,18, TRUE},    {31,18, TRUE},    {31,18, TRUE},
  493.     {27, 1, FALSE},    {27,14, FALSE},    {27, 3, TRUE},    {27,13, FALSE},
  494.     {27, 3, TRUE},    {31,18, TRUE},    {31,18, TRUE},    {31,18, TRUE},
  495.     {31,18, TRUE},    {27, 3, TRUE},    {31,18, TRUE},    {31,18, TRUE},
  496.     {31,18, TRUE},    {27, 3, TRUE}
  497.     },
  498.  
  499. /*
  500.     STATE 20 =    {dec or hex}
  501. */
  502.     {    
  503.     {0,20, FALSE},    {29, 3, FALSE},    {29, 3, TRUE},    {29, 3, TRUE},
  504.     {29, 3, TRUE},    {29, 3, TRUE},    {29, 3, TRUE},    {29, 3, TRUE},
  505.     {29, 3, TRUE},    {32,18, TRUE},    {32,18, TRUE},    {32,18, TRUE},
  506.     {29, 1, FALSE},    {29,14, FALSE},    {29, 3, TRUE},    {29,13, FALSE},
  507.     {29, 3, TRUE},    {32,18, TRUE},    {32,18, TRUE},    {32,18, TRUE},
  508.     {32,18, TRUE},    {29, 3, TRUE},    {32,18, TRUE},    {32,18, TRUE},
  509.     {32,18, TRUE},    {29, 3, TRUE}
  510.     },
  511.  
  512. /*
  513.     STATE 21 =    {bslash quote}
  514. */
  515.     {
  516.     {0,21, FALSE},    {4,11, FALSE},    {34, 3, TRUE},    {4,11, FALSE},
  517.     {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},
  518.     {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},
  519.     {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},
  520.     {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},
  521.     {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},    {4,11, FALSE},
  522.     {4,11, FALSE},  {4,11, FALSE}
  523.     },
  524.  
  525. /*
  526.     STATE 22 =    {bslash appos}
  527. */
  528.     {
  529.     {0,22, FALSE},    {4,12, FALSE},    {34, 3, TRUE},    {4,12, FALSE},
  530.     {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},
  531.     {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},
  532.     {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},
  533.     {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},
  534.     {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},    {4,12, FALSE},
  535.     {4,12, FALSE},    {4,12, FALSE}
  536.     }
  537. };
  538.     
  539. #define YEXL 32
  540. static char yytext[YEXL];
  541.  
  542. static char *erryytextex(type)
  543.     int type;
  544. {
  545.     char * strptr, *endptr;
  546.     int charcnt;
  547.  
  548.     strptr = (lasttokfetch -> textstrt) - 1;
  549.     if(type == STRING)
  550.     {
  551.         endptr = (lasttokfetch -> textend) - 1;
  552.         if(*endptr == '\n')
  553.             endptr --;
  554.     }
  555.     else
  556.     {
  557.         endptr = (lasttokfetch -> textend) - 2;
  558.     }
  559.  
  560.     for(charcnt = 0; (strptr <= endptr) && charcnt < (YEXL - 1); charcnt ++)
  561.     {
  562.         yytext[charcnt] = *strptr++;
  563.     }
  564.     yytext[charcnt] = '\0';
  565. }
  566.  
  567. int yylex()
  568. {
  569.     int scanstate;
  570.     char *thistokstart;
  571.     register char nextchar;
  572.     int charset;
  573.     long consaccum, consbase;
  574.  
  575.  
  576.  
  577.     if(currtok >= intokcnt)
  578.     {
  579.         switch(nextreadact)
  580.         {
  581.         case Nra_new:  /* access next file */
  582.             fprintf(intermedf, "F:%s\n", infilestk[++currfstk].fnm);
  583.             yyin = infilestk[currfstk].fpt;
  584.             nextreadact = Nra_normal;
  585.         case Nra_normal:
  586.             if(frareadrec())
  587.             {
  588.                 /* EOF */;
  589.                 return 0;
  590.             }
  591.             break;
  592.  
  593.         case Nra_end:  /* pop file and access previous */
  594.             if(currfstk > 0)
  595.             {
  596.                 fclose(yyin);
  597.                 yyin = infilestk[--currfstk].fpt;
  598.                 fprintf(intermedf, "X:%s\n",
  599.                     infilestk[currfstk].fnm);
  600.                 if(frareadrec())
  601.                 {
  602.                     /* EOF */;
  603.                     return 0;
  604.                 }
  605.                 else
  606.                 {
  607.                     nextreadact = Nra_normal;
  608.                 }
  609.             }
  610.             else
  611.             {
  612.                 /* EOF */;
  613.                 return 0;
  614.             }
  615.             break;
  616.         }
  617.  
  618.         if(listflag)
  619.         {
  620.             fputs(finbuff, intermedf);
  621.         }
  622.         else
  623.         {
  624.             fputs("L:\n", intermedf);
  625.         }
  626.  
  627.         /* Scan a line */
  628.  
  629.         frainptr = &finbuff[2];
  630.  
  631.         currtok = intokcnt = 0;
  632.         nexttokload = & scanqueue[0];
  633.  
  634.         tptrstr = &tempstrpool[0];
  635.         scanstate = 0;
  636.         whichsym = Symopcode;
  637.  
  638.         while( (nextchar = *frainptr++) != '\0' )
  639.         {
  640.             charset = chartrantab[nextchar & 0x7f];
  641.             do {
  642.                 thisact =  & characttab [scanstate][charset];
  643.  
  644. #if DEBUG
  645.     if(isprint(nextchar))
  646.         printf("%c    ", nextchar);
  647.     else
  648.         printf("0x%2.2x ", nextchar);
  649.     printf("%-18s %-33s %-11s  %2.2d\n",
  650.         statelab[scanstate],
  651.         actlab[thisact -> action],
  652.         thisact -> contin ? "Continue" : "Swallow",
  653.         thisact -> nextstate);
  654. #endif
  655.  
  656.                 switch(thisact -> action)
  657.                 {
  658.                 case 0: /* skip/no op */
  659.                     break;
  660.  
  661.                 case 1: /* load EOL token */
  662.                     nexttokload -> lvalv.longv = 0;
  663.                     nexttokload -> tokv = EOL;
  664.                     nexttokload -> errtype = Yetunprint;
  665.                     nexttokload++;
  666.                     intokcnt++; 
  667.                     break;
  668.  
  669.                 case 2: /* start string */
  670.                     thistokstart = tptrstr;
  671.                     nexttokload -> textstrt = frainptr;
  672.                     break;
  673.  
  674.                 case 3: /* process label */
  675.                     {
  676.             struct symel *tempsym;
  677.  
  678.             *tptrstr++ = '\0';
  679.             tempsym = symbentry(thistokstart, SYMBOL);
  680.             if((tempsym -> seg) != SSG_RESV)
  681.             {
  682.                 nexttokload -> tokv = LABEL;
  683.                 nexttokload -> errtype = Yetsymbol;
  684.                 nexttokload -> lvalv.symb = tempsym;
  685.             }
  686.             else
  687.             {
  688.                 nexttokload -> tokv = tempsym -> tok;
  689.                 nexttokload -> errtype = Yetreserved;
  690.                 nexttokload -> lvalv.intv = tempsym -> value;
  691.             }
  692.             nexttokload -> textend = frainptr;
  693.             nexttokload++;
  694.             intokcnt++; 
  695.                     }
  696.                     break;
  697.  
  698.                 case 4: /* save string char */
  699.                     *tptrstr++ = nextchar;
  700.                     break;
  701.  
  702.                 case 5: /* load single char token */
  703.                     nexttokload -> lvalv.longv = 0;
  704.                     nexttokload -> tokv = nextchar;
  705.                     nexttokload -> errtype = Yetprint;
  706.                     nexttokload++;
  707.                     intokcnt++; 
  708.                     break;
  709.  
  710.                 case 6: /* load EQ token */
  711.                     nexttokload -> lvalv.longv = 0;
  712.                     nexttokload -> tokv = KEOP_EQ;
  713.                     nexttokload -> errtype = Yetunprint;
  714.                     nexttokload++;
  715.                     intokcnt++;
  716.                     break;
  717.  
  718.                 case 7: /* process symbol */
  719.                     {
  720.             register struct symel *symp;
  721.             register char *ytp;
  722.             int tempov;
  723.  
  724.             *tptrstr++ = '\0';
  725.             if(whichsym == Symopcode)
  726.             {
  727.                 for(ytp = thistokstart; *ytp != '\0'; 
  728.                     ytp++)
  729.                 {
  730.                     if(islower(*ytp))
  731.                     {
  732.                         *ytp = toupper(*ytp);
  733.                     }
  734.                 }
  735.                 nexttokload -> lvalv.intv 
  736.                     = tempov = findop(thistokstart);
  737.                 nexttokload -> tokv = 
  738.                     optab[tempov].token;
  739.                 nexttokload -> errtype = Yetopcode;
  740.                 whichsym = Symsym;
  741.             }
  742.             else
  743.             {
  744.                 symp = symbentry(thistokstart,SYMBOL);
  745.                 if(symp -> seg != SSG_RESV)
  746.                 {
  747.                     nexttokload -> lvalv.symb = symp;
  748.                     nexttokload -> errtype = Yetsymbol;
  749.                 }
  750.                 else
  751.                 {
  752.                     nexttokload -> lvalv.intv 
  753.                         = symp->value;
  754.                     nexttokload -> errtype = Yetreserved;
  755.                 }
  756.  
  757.                 nexttokload -> tokv = symp -> tok;
  758.             }
  759.  
  760.             nexttokload -> textend = frainptr;
  761.             nexttokload++;
  762.             intokcnt++;
  763.                     }
  764.                     break;
  765.  
  766.                 case 8: /* load $ token */
  767.                     nexttokload -> lvalv.longv = 0;
  768.                     nexttokload -> tokv = '$';
  769.                     nexttokload -> errtype = Yetprint;
  770.                     nexttokload++;
  771.                     intokcnt++;
  772.                     break;
  773.  
  774.                 case 9: /* setup for $hex */
  775.                     consbase = 16;
  776.                     consaccum = 0;
  777.                     break;
  778.  
  779.                 case 10: /* accumulate 0-9 constant */
  780.                     consaccum = (consaccum * consbase)
  781.                         + (nextchar - '0');
  782.                     break;
  783.  
  784.                 case 11: /* accumulate A-F constant  */
  785.                     consaccum = (consaccum * consbase)
  786.                         + (nextchar - 'A' + 10);
  787.                     break;
  788.  
  789.                 case 12: /* accumulate a-f constant */
  790.                     consaccum = (consaccum * consbase)
  791.                         + (nextchar - 'a' + 10);
  792.                     break;
  793.  
  794.                 case 13: /* load Constant token */
  795.                     nexttokload -> lvalv.longv = 
  796.                         consaccum;
  797.                     nexttokload -> tokv = CONSTANT;
  798.                     nexttokload -> errtype = Yetconstant;
  799.                     nexttokload -> textend = frainptr;
  800.                     nexttokload++;
  801.                     intokcnt++;
  802.                     break;
  803.  
  804.                 case 14: /* load @ token */
  805.                     nexttokload -> lvalv.longv = 0;
  806.                     nexttokload -> tokv = '@';
  807.                     nexttokload -> errtype = Yetprint;
  808.                     nexttokload++;
  809.                     intokcnt++;
  810.                     break;
  811.  
  812.                 case 15: /* setup for @octal */
  813.                     consbase = 8;
  814.                     consaccum = 0;
  815.                     break;
  816.  
  817.                 case 16: /* setup for %binary */
  818.                     consbase = 2;
  819.                     consaccum = 0;
  820.                     break;
  821.  
  822.                 case 17: /* load % token */
  823.                     nexttokload -> lvalv.longv = 0;
  824.                     nexttokload -> tokv = '%';
  825.                     nexttokload -> errtype = Yetprint;
  826.                     nexttokload++;
  827.                     intokcnt++;
  828.                     break;
  829.  
  830.                 case 18: /* load String token */
  831.                     *tptrstr++  = '\0';
  832.                     nexttokload -> lvalv.strng = 
  833.                         thistokstart;
  834.                     nexttokload -> tokv = STRING;
  835.                     nexttokload -> errtype = Yetstring;
  836.                     nexttokload -> textend = frainptr;
  837.                     nexttokload++;
  838.                     intokcnt++;
  839.                     break;
  840.  
  841.                 case 19: /* load GE token */
  842.                     nexttokload -> lvalv.longv = 0;
  843.                     nexttokload -> tokv = KEOP_GE;
  844.                     nexttokload -> errtype = Yetunprint;
  845.                     nexttokload++;
  846.                     intokcnt++;
  847.                     break;
  848.  
  849.                 case 20: /* load GT token */
  850.                     nexttokload -> lvalv.longv = 0;
  851.                     nexttokload -> tokv = KEOP_GT;
  852.                     nexttokload -> errtype = Yetunprint;
  853.                     nexttokload++;
  854.                     intokcnt++;
  855.                     break;
  856.  
  857.                 case 21: /* load LE token */
  858.                     nexttokload -> lvalv.longv = 0;
  859.                     nexttokload -> tokv = KEOP_LE;
  860.                     nexttokload -> errtype = Yetunprint;
  861.                     nexttokload++;
  862.                     intokcnt++;
  863.                     break;
  864.  
  865.                 case 22: /* load NE token */
  866.                     nexttokload -> lvalv.longv = 0;
  867.                     nexttokload -> tokv = KEOP_NE;
  868.                     nexttokload -> errtype = Yetunprint;
  869.                     nexttokload++;
  870.                     intokcnt++;
  871.                     break;
  872.  
  873.                 case 23: /* load LT token */
  874.                     nexttokload -> lvalv.longv = 0;
  875.                     nexttokload -> tokv = KEOP_LT;
  876.                     nexttokload -> errtype = Yetunprint;
  877.                     nexttokload++;
  878.                     intokcnt++;
  879.                     break;
  880.  
  881.                 case 24: /* save numeric char 0-9 */
  882.                     *tptrstr++ = nextchar - '0';
  883.                     break;
  884.  
  885.                 case 25: /* save numeric char A-F */
  886.                     *tptrstr++ = nextchar - 'A' + 10;
  887.                     break;
  888.  
  889.                 case 26: /* save numeric char a-f */
  890.                     *tptrstr++ = nextchar - 'a' + 10;
  891.                     break;
  892.  
  893.                 case 27: /* convert numeric string base 2 */
  894.                     {
  895.             consaccum = 0;
  896.             while(thistokstart < tptrstr)
  897.             {
  898.                 consaccum = (consaccum * 2) + *thistokstart++;
  899.             }
  900.             nexttokload -> lvalv.longv = consaccum;
  901.             nexttokload -> tokv = CONSTANT;
  902.             nexttokload -> errtype = Yetconstant;
  903.             nexttokload -> textend = frainptr;
  904.             nexttokload++;
  905.             intokcnt++;
  906.                     }
  907.                     break;
  908.  
  909.                 case 28: /* convert numeric string base 8 */
  910.                     {
  911.             consaccum = 0;
  912.             while(thistokstart < tptrstr)
  913.             {
  914.                 consaccum = (consaccum * 8) + *thistokstart++;
  915.             }
  916.             nexttokload -> lvalv.longv = consaccum;
  917.             nexttokload -> tokv = CONSTANT;
  918.             nexttokload -> errtype = Yetconstant;
  919.             nexttokload -> textend = frainptr;
  920.             nexttokload++;
  921.             intokcnt++;
  922.                     }
  923.                     break;
  924.  
  925.                 case 29: /* convert numeric string base 10 */
  926.                     {
  927.             consaccum = 0;
  928.             while(thistokstart < tptrstr)
  929.             {
  930.                 consaccum = (consaccum * 10) + *thistokstart++;
  931.             }
  932.             nexttokload -> lvalv.longv = consaccum;
  933.             nexttokload -> tokv = CONSTANT;
  934.             nexttokload -> errtype = Yetconstant;
  935.             nexttokload -> textend = frainptr;
  936.             nexttokload++;
  937.             intokcnt++;
  938.                     }
  939.                     break;
  940.  
  941.                 case 30: /* convert numeric string base 16 */
  942.                     {
  943.             consaccum = 0;
  944.             while(thistokstart < tptrstr)
  945.             {
  946.                 consaccum = (consaccum * 16) + *thistokstart++;
  947.             }
  948.             nexttokload -> lvalv.longv = consaccum;
  949.             nexttokload -> tokv = CONSTANT;
  950.             nexttokload -> errtype = Yetconstant;
  951.             nexttokload -> textend = frainptr;
  952.             nexttokload++;
  953.             intokcnt++;
  954.                     }
  955.                     break;
  956.  
  957.                 case 31: /* save numeric 0xb */
  958.                     *tptrstr++ = 0xb;
  959.                     break;
  960.  
  961.                 case 32: /* save numeric 0xd */
  962.                     *tptrstr++ = 0xd;
  963.                     break;
  964.  
  965.                 case 33: /* set text start */
  966.                     nexttokload -> textstrt = frainptr;
  967.                     break;
  968.                 
  969.                 case 34: /* token choke */
  970.                     nexttokload -> lvalv.longv = 0L;
  971.                     nexttokload -> tokv = KTK_invalid;
  972.                     nexttokload -> errtype = Yetinvalid;
  973.                     nexttokload -> textend = frainptr;
  974.                     nexttokload++;
  975.                     intokcnt++;
  976.                     break;
  977.                 }
  978.  
  979.                 scanstate = thisact -> nextstate;
  980.  
  981.             }  while( thisact -> contin);
  982.         }
  983.  
  984.         if(intokcnt <= 0)
  985.         { /* no tokens in line (comment or whitespace overlength) */
  986.             scanqueue[0].tokv = EOL;
  987.             scanqueue[0].errtype = Yetunprint;
  988.             scanqueue[0].lvalv.longv = 0;
  989.             intokcnt = 1;
  990.         }
  991.  
  992.         if(scanstate != 0)
  993.         { /* no EOL */
  994.             fraerror("Overlength/Unterminated Line");
  995.         }
  996.     }
  997.     lasttokfetch = &scanqueue[currtok++];
  998.     yylval = lasttokfetch -> lvalv;
  999.     return lasttokfetch -> tokv;
  1000. }
  1001.  
  1002.  
  1003. yyerror(str)
  1004.     char *str;
  1005. /*    
  1006.     description    first pass - output a parser error to intermediate file
  1007. */
  1008. {
  1009.     char * taglab;
  1010.  
  1011.     switch(lasttokfetch -> errtype)
  1012.     {
  1013.     case Yetprint:
  1014.         if( ! isprint(lasttokfetch -> tokv))
  1015.         {
  1016.             fprintf(intermedf, 
  1017.                 "E: ERROR - %s at/before character \"^%c\"\n",
  1018.                 str, PRINTCTRL(lasttokfetch -> tokv));
  1019.         }
  1020.         else
  1021.         {
  1022.             fprintf(intermedf, 
  1023.                 "E: ERROR - %s at/before character \"%c\"\n",
  1024.                 str, lasttokfetch -> tokv );
  1025.         }
  1026.         break;
  1027.  
  1028.     case Yetsymbol: 
  1029.     case Yetreserved: 
  1030.     case Yetopcode: 
  1031.     case Yetconstant: 
  1032.         erryytextex(SYMBOL);
  1033.         fprintf(intermedf, "E: ERROR - %s at/before token \"%s\" \n",
  1034.             str, yytext);
  1035.         break;
  1036.  
  1037.     case Yetinvalid: 
  1038.         erryytextex(SYMBOL);
  1039.         fprintf(intermedf, "E: ERROR - %s at invalid token \"%s\" \n",
  1040.             str, yytext);
  1041.         break;
  1042.  
  1043.     case Yetstring:
  1044.         erryytextex(STRING);
  1045.         fprintf(intermedf, "E: ERROR - %s at/before string %s \n",
  1046.             str, yytext);
  1047.         break;
  1048.  
  1049.     case Yetunprint:
  1050.         switch(lasttokfetch -> tokv)
  1051.         {
  1052.         case EOL:
  1053.             taglab = "End of Line";
  1054.             break;
  1055.         case KEOP_EQ:
  1056.             taglab = "\"=\"";
  1057.             break;
  1058.         case KEOP_GE:
  1059.             taglab = "\">=\"";
  1060.             break;
  1061.         case KEOP_GT:
  1062.             taglab = "\">\"";
  1063.             break;
  1064.         case KEOP_LE:
  1065.             taglab = "\"<=\"";
  1066.             break;
  1067.         case KEOP_NE:
  1068.             taglab = "\"<>\"";
  1069.             break;
  1070.         case KEOP_LT:
  1071.             taglab = "\"<\"";
  1072.             break;
  1073.         default:
  1074.             taglab = "Undeterminable Symbol";
  1075.             break;
  1076.         }
  1077.         fprintf(intermedf, "E: ERROR - %s at/before %s\n",
  1078.             str, taglab);
  1079.         break;
  1080.  
  1081.     default:
  1082.         fprintf(intermedf, "E: ERROR - %s - undetermined yyerror type\n",
  1083.             str);
  1084.         break;
  1085.     }
  1086.  
  1087.     errorcnt++;
  1088. }
  1089.